package com.kawa.kemanage.service.impl;

import com.kawa.kemanage.entity.Report;
import com.kawa.kemanage.mapper.ReportMapper;
import com.kawa.kemanage.service.ReportService;
import com.kawa.kemanage.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ReportServiceImpl implements ReportService {

    @Autowired
    private ReportMapper reportMapper;

    @Override
    public Result<String> addReport(Report report) {
        try {
            int rows = reportMapper.addReport(report);
            if (rows > 0) {
                return Result.success("举报成功，感谢您的反馈！");
            } else {
                return Result.error("举报失败");
            }
        } catch (Exception e) {
            return Result.error(500, "数据库操作异常: " + e.getMessage());
        }
    }
}
